$(function(){
    /*图表一*/
    var dataOne = {"create_time":"2017-09-30 10:25:22","jt":0,"qt":0,"qz":0,"xs":0,"za":0,"total":0};
    var dataTwo = {"cjcqy":0,"create_time":"2017-09-30 10:25:11","mchqy":1,"wjwqy":3,"ywqy":2,"zywqy":3,"total":0};
	var optionOne = {
        title: {
              text: '今日警情底数',
              textStyle:{
                color:'#ADDBFF',
                fontSize:25,
                fontWeight:'normal',
                
              },
              left: 'center',
              subtext : '总共'+dataOne.total+'起',
              subtextStyle: {
                color:'#2787D9',
                fontSize: 23,
              }
        },
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            orient : 'horizontal',
            bottom: 20,
            data:['刑事','治安','交通','求助','其他'],
            textStyle:{
                color:'#ADDBFF',
                fontSize:15,
              }
        },
        series : [
            {
                name:'访问来源',
                type:'pie',
                radius : ['35%', '50%'],
                itemStyle : {
                    normal : {
                        label : {
                            show : true,
                            formatter: "{c}\n{b}",
                            textStyle : {
                                fontSize : '18',
                            }
                        },
                        labelLine : {
                            show : true,
                            length: 20,
                            length2: 30,
                        }
                    },
                    emphasis : {
                        label : {
                            show : true,
                            position : 'center',
                            textStyle : {
                                fontSize : '22',
                                color:'#39B2F5'
                            }
                        }
                    }
                },
                data:[
                    {value:dataOne.xs, name:'刑事',itemStyle:{normal:{color:'#59F6F7'}}},
                    {value:dataOne.za, name:'治安',itemStyle:{normal:{color:'#2787ff'}}},
                    {value:dataOne.jt, name:'交通',itemStyle:{normal:{color:'#369BC9'}}},
                    {value:dataOne.qz, name:'求助',itemStyle:{normal:{color:'#A693FF'}}},
                    {value:dataOne.qt,name:'其他',itemStyle:{normal:{color:'#369Bff'}}}
                ]
            }
        ]

        
        };

    var myChartOne = echarts.init(document.getElementById('echart-left'));
    myChartOne.setOption(optionOne);
    $(window).resize(myChartOne.resize);

    /*图表二*/
    var optionTwo = {
        color: ['#3398DB'],
        tooltip : {
            trigger: 'axis',
            axisPointer : {            
                type : 'shadow'        
            }
        },
        grid: {
            left: '10%',
            right: '10%',
            show: false,
            tooltip:{
                axisPointer:{
                    lineStyle:{
                        width:0
                    }
                }
            }
        },
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        
        xAxis : [
            {
                type : 'category',
                data : ['在岗','越界','久坐','脱岗','离岗'],
                axisTick: {
                    alignWithLabel: true
                },
                axisLine:{
                    lineStyle:{
                        color:'#59F6F7'
                    }
                },
                axisLabel: {        
                    show: true,
                    textStyle: {
                        fontSize:'16'
                    }
                },
            }
        ],
        yAxis : [
            {
                type : 'value',
                axisLine:{
                    
                    lineStyle:{
                        color:'#59F6F7'
                    }
                },
                splitLine:{
                    show:false
                },
                 axisLabel: {        
                    show: true,
                    textStyle: {
                        fontSize:16
                    }
                },
            }
        ],
        series : [
            {
                name:'直接访问',
                type:'bar',
                
                itemStyle : {
                    normal : {
                        label : {
                            show : true,
                            formatter: "{c}\n{b}",
                            position : 'top',
                            textStyle : {
                                fontSize : '16',
                            }
                        },
                        
                    },
                    emphasis : {
                        label : {
                            show : true,
                            position : 'top',
                            textStyle : {
                                fontSize : '20',
                                color:'#39B2F5'
                            }
                        }

                    }
                },
                barWidth: '30%',
                data:[{value:dataTwo.wjwqy, name:'在岗',itemStyle:{normal:{color:'#59F6F7'}}},
                {value:dataTwo.cjcqy, name:'越界',itemStyle:{normal:{color:'#2787ff'}}},
                {value:dataTwo.mchqy, name:'久坐',itemStyle:{normal:{color:'#369BC9'}}},
                {value:dataTwo.ywqy, name:'脱岗',itemStyle:{normal:{color:'#A693FF'}}},
                {value:dataTwo.zywqy,name:'离岗',itemStyle:{normal:{color:'#369Bff'}}}]
            }
        ]
    };

    var myChartTwo = echarts.init(document.getElementById('echart-right'));
    myChartTwo.setOption(optionTwo)
    $(window).resize(myChartTwo.resize);
});





